<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>21.13. smtpd — SMTP Server &mdash; Python v2.6.2 documentation</title>
    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '2.6.2',
        COLLAPSE_MODINDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within Python v2.6.2 documentation"
          href="../_static/opensearch.xml"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="copyright" title="Copyright" href="../copyright.html" />
    <link rel="top" title="Python v2.6.2 documentation" href="../index.html" />
    <link rel="up" title="21. Internet Protocols and Support" href="internet.html" />
    <link rel="next" title="21.14. telnetlib — Telnet client" href="telnetlib.html" />
    <link rel="prev" title="21.12. smtplib — SMTP protocol client" href="smtplib.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
 

  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../modindex.html" title="Global Module Index"
             accesskey="M">modules</a> |</li>
        <li class="right" >
          <a href="telnetlib.html" title="21.14. telnetlib — Telnet client"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="smtplib.html" title="21.12. smtplib — SMTP protocol client"
             accesskey="P">previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="../index.html">Python v2.6.2 documentation</a> &raquo;</li>

          <li><a href="index.html" >The Python Standard Library</a> &raquo;</li>
          <li><a href="internet.html" accesskey="U">21. Internet Protocols and Support</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="module-smtpd">
<h1>21.13. <tt class="xref docutils literal"><span class="pre">smtpd</span></tt> &#8212; SMTP Server<a class="headerlink" href="#module-smtpd" title="Permalink to this headline">¶</a></h1>
<p>This module offers several classes to implement SMTP servers.  One is a generic
do-nothing implementation, which can be overridden, while the other two offer
specific mail-sending strategies.</p>
<div class="section" id="smtpserver-objects">
<h2>21.13.1. SMTPServer Objects<a class="headerlink" href="#smtpserver-objects" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="smtpd.SMTPServer">
<em class="property">
class </em><tt class="descclassname">smtpd.</tt><tt class="descname">SMTPServer</tt><big>(</big><em>localaddr</em>, <em>remoteaddr</em><big>)</big><a class="headerlink" href="#smtpd.SMTPServer" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a new <a title="smtpd.SMTPServer" class="reference internal" href="#smtpd.SMTPServer"><tt class="xref docutils literal"><span class="pre">SMTPServer</span></tt></a> object, which binds to local address
<em>localaddr</em>.  It will treat <em>remoteaddr</em> as an upstream SMTP relayer.  It
inherits from <a title="asyncore.dispatcher" class="reference external" href="asyncore.html#asyncore.dispatcher"><tt class="xref docutils literal"><span class="pre">asyncore.dispatcher</span></tt></a>, and so will insert itself into
<a title="A base class for developing asynchronous socket handling services." class="reference external" href="asyncore.html#module-asyncore"><tt class="xref docutils literal"><span class="pre">asyncore</span></tt></a>&#8216;s event loop on instantiation.</p>
<dl class="method">
<dt id="smtpd.SMTPServer.process_message">
<tt class="descname">process_message</tt><big>(</big><em>peer</em>, <em>mailfrom</em>, <em>rcpttos</em>, <em>data</em><big>)</big><a class="headerlink" href="#smtpd.SMTPServer.process_message" title="Permalink to this definition">¶</a></dt>
<dd>Raise <a title="exceptions.NotImplementedError" class="reference external" href="exceptions.html#exceptions.NotImplementedError"><tt class="xref docutils literal"><span class="pre">NotImplementedError</span></tt></a> exception. Override this in subclasses to
do something useful with this message. Whatever was passed in the
constructor as <em>remoteaddr</em> will be available as the <tt class="xref docutils literal"><span class="pre">_remoteaddr</span></tt>
attribute. <em>peer</em> is the remote host&#8217;s address, <em>mailfrom</em> is the envelope
originator, <em>rcpttos</em> are the envelope recipients and <em>data</em> is a string
containing the contents of the e-mail (which should be in <span class="target" id="index-534"></span><a class="reference external" href="http://tools.ietf.org/html/rfc2822.html"><strong>RFC 2822</strong></a>
format).</dd></dl>

</dd></dl>

</div>
<div class="section" id="debuggingserver-objects">
<h2>21.13.2. DebuggingServer Objects<a class="headerlink" href="#debuggingserver-objects" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="smtpd.DebuggingServer">
<em class="property">
class </em><tt class="descclassname">smtpd.</tt><tt class="descname">DebuggingServer</tt><big>(</big><em>localaddr</em>, <em>remoteaddr</em><big>)</big><a class="headerlink" href="#smtpd.DebuggingServer" title="Permalink to this definition">¶</a></dt>
<dd>Create a new debugging server.  Arguments are as per <a title="smtpd.SMTPServer" class="reference internal" href="#smtpd.SMTPServer"><tt class="xref docutils literal"><span class="pre">SMTPServer</span></tt></a>.
Messages will be discarded, and printed on stdout.</dd></dl>

</div>
<div class="section" id="pureproxy-objects">
<h2>21.13.3. PureProxy Objects<a class="headerlink" href="#pureproxy-objects" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="smtpd.PureProxy">
<em class="property">
class </em><tt class="descclassname">smtpd.</tt><tt class="descname">PureProxy</tt><big>(</big><em>localaddr</em>, <em>remoteaddr</em><big>)</big><a class="headerlink" href="#smtpd.PureProxy" title="Permalink to this definition">¶</a></dt>
<dd>Create a new pure proxy server. Arguments are as per <a title="smtpd.SMTPServer" class="reference internal" href="#smtpd.SMTPServer"><tt class="xref docutils literal"><span class="pre">SMTPServer</span></tt></a>.
Everything will be relayed to <em>remoteaddr</em>.  Note that running this has a good
chance to make you into an open relay, so please be careful.</dd></dl>

</div>
<div class="section" id="mailmanproxy-objects">
<h2>21.13.4. MailmanProxy Objects<a class="headerlink" href="#mailmanproxy-objects" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="smtpd.MailmanProxy">
<em class="property">
class </em><tt class="descclassname">smtpd.</tt><tt class="descname">MailmanProxy</tt><big>(</big><em>localaddr</em>, <em>remoteaddr</em><big>)</big><a class="headerlink" href="#smtpd.MailmanProxy" title="Permalink to this definition">¶</a></dt>
<dd>Create a new pure proxy server. Arguments are as per <a title="smtpd.SMTPServer" class="reference internal" href="#smtpd.SMTPServer"><tt class="xref docutils literal"><span class="pre">SMTPServer</span></tt></a>.
Everything will be relayed to <em>remoteaddr</em>, unless local mailman configurations
knows about an address, in which case it will be handled via mailman.  Note that
running this has a good chance to make you into an open relay, so please be
careful.</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <h3><a href="../contents.html">Table Of Contents</a></h3>
            <ul>
<li><a class="reference external" href="">21.13. <tt class="docutils literal"><span class="pre">smtpd</span></tt> &#8212; SMTP Server</a><ul>
<li><a class="reference external" href="#smtpserver-objects">21.13.1. SMTPServer Objects</a></li>
<li><a class="reference external" href="#debuggingserver-objects">21.13.2. DebuggingServer Objects</a></li>
<li><a class="reference external" href="#pureproxy-objects">21.13.3. PureProxy Objects</a></li>
<li><a class="reference external" href="#mailmanproxy-objects">21.13.4. MailmanProxy Objects</a></li>
</ul>
</li>
</ul>

            <h4>Previous topic</h4>
            <p class="topless"><a href="smtplib.html"
                                  title="previous chapter">21.12. <tt class="docutils literal docutils literal"><span class="pre">smtplib</span></tt> &#8212; SMTP protocol client</a></p>
            <h4>Next topic</h4>
            <p class="topless"><a href="telnetlib.html"
                                  title="next chapter">21.14. <tt class="docutils literal"><span class="pre">telnetlib</span></tt> &#8212; Telnet client</a></p>
            <h3>This Page</h3>
            <ul class="this-page-menu">
              <li><a href="../_sources/library/smtpd.txt"
                     rel="nofollow">Show Source</a></li>
            </ul>
          <div id="searchbox" style="display: none">
            <h3>Quick search</h3>
              <form class="search" action="../search.html" method="get">
                <input type="text" name="q" size="18" />
                <input type="submit" value="Go" />
                <input type="hidden" name="check_keywords" value="yes" />
                <input type="hidden" name="area" value="default" />
              </form>
              <p class="searchtip" style="font-size: 90%">
              Enter search terms or a module, class or function name.
              </p>
          </div>
          <script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../modindex.html" title="Global Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="telnetlib.html" title="21.14. telnetlib — Telnet client"
             >next</a> |</li>
        <li class="right" >
          <a href="smtplib.html" title="21.12. smtplib — SMTP protocol client"
             >previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="../index.html">Python v2.6.2 documentation</a> &raquo;</li>

          <li><a href="index.html" >The Python Standard Library</a> &raquo;</li>
          <li><a href="internet.html" >21. Internet Protocols and Support</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
      &copy; <a href="../copyright.html">Copyright</a> 1990-2009, Python Software Foundation.
      Last updated on Apr 15, 2009.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.1.
    </div>
  </body>
</html>